package com.dong.config;

import com.dong.bean.Person;
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Scope;


/**  @Scope:
 *  * {@link ConfigurableBeanFactory#SCOPE_PROTOTYPE}   多实例: 拿一个再创建一个
 * 	 * {@link  ConfigurableBeanFactory#SCOPE_SINGLETON}      单实例: 创建容器的时候直接创建
 * 	 * {@link  org.springframework.web.context.WebApplicationContext#SCOPE_REQUEST}
 * 	 * {@link  org.springframework.web.context.WebApplicationContext#SCOPE_SESSION}
 */
@Configuration
public class T020ScopeConfig {
    @Bean
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public Person person() {
        return new Person("张三",25);
    }
}
